
/**************************************************************************
** 
** File name   : replication_ISQ.do
** Date        : April 12th, 2019
** Author      : Emilie Hafner-Burton and Christina J. Schneider (cjschneider@ucsd.edu)
** Purpose     : Replicates main results of "The Dark Side of Cooperation: International Organizations 
					and Member Corruption (International Studies Quarterly)"
** Requires    : replication_data_ISQ.dta, interact.ado, grinter.ado
** Output      : replication_ISQ.log
**
**************************************************************************/


clear
clear matrix
clear mata
set more off
set maxvar 32000
version 14

cd ""

cd "/Users/ChristinaSchneider/Dropbox (The Slantchev Family)/Work/Projects/Shared/Emilie & Christina/Corruption Project/Drafts/ISQ/Replication Package"


#delimit ;

log using replication_ISQ, replace;

use replication_ISQ.dta, replace;


**FIGURE 1**;

twoway (scatter IGO_icrg_avg_wt_neg_reg year if year>1987 & year<2014 & ccode==800, sort) 
|| (scatter icrg_corruption_neg year if year>1987 & year<2014 & ccode==800, sort)
, xtitle("Year") ytitle("Level of Corrutpion") scheme(s1mono);

graph export replication_figure1.eps, replace; 

**Table 1**;

#delimit; 

gen period=.;

replace period = 10 if year==2013| year==2012|year==2011|year==2010;
replace period = 9 if year==2009|year==2008|year==2007;
replace period = 8 if year==2006|year==2005|year==2004;
replace period = 7 if year==2003|year==2002|year==2001;
replace period = 6 if year==2000|year==1999|year==1998;
replace period = 5 if year==1997|year==1996|year==1996;
replace period = 4 if year==1995|year==1994|year==1993;
replace period = 3 if year==1992|year==1991|year==1990;
replace period = 2 if year==1989|year==1988|year==1987;
replace period = 1 if year==1986|year==1985|year==1984;


drop if period==.;


collapse polity2 gdppercap_log rgdppc_growth tradeopen durable  icrg_corruption_neg 
IGO_icrg_avg_wt_neg_reg wt_icrg_region_neg IGO_icrg_avg_neg_reg  icrg_region_neg 
wt_icrg_cont_avg_neg icrg_cont_avg_neg IGO_icrg_avg_neg_reg_growth embeddedness_diff RIO_mandates_enforce 
IGO_icrg_avg_reg_mandate_wt_neg IGO_icrg_avg_reg_nomand_wt_neg wgiscore_neg IGO_wgiscore_avg_neg_wt_reg 
cpiscore_neg IGO_cpiscore_avg_reg_wt_neg  bribery_log IGO_bribery_avg_reg_wt  fdi_gdp RIO_memberships 
numvote IGO_icrg_avg_wt_neg IGO_icrg_avg_neg_econreg_wt  mdmh protestant IGO_icrg_max_neg_reg_wt freedom_mean
IGO_icrg_avg_neg_polreg_wt IGO_icrg_avg_neg_socialreg_wt region lji wgi_law  
 (max) conflict_inter conflict_intra presidential, by(period ccode);
 

gen regper=(region*100)+period;

 
 
label var polity2 "Democracy";
label var rgdppc_growth "PC GDP Growth (%)";
label var gdppercap_log "PC GDP (log)";
label var tradeopen "Trade Openness";
label var durable "Regime Durability";
label var IGO_icrg_avg_neg_reg "Avg IO Corruption";
label var IGO_icrg_avg_wt_neg_reg "Avg IO Corruption";
label var IGO_icrg_avg_wt_neg_reg "Avg IO Corruption";
label var IGO_icrg_avg_wt_neg "Avg IO Corruption (All)";
label var IGO_icrg_avg_neg_econreg_wt "Avg IO Corruption (Econ)";
label var IGO_icrg_avg_neg_polreg_wt "Avg IO Corruption (Pol)";
label var IGO_icrg_avg_neg_socialreg_wt "Avg IO Corruption (Social)";
label var IGO_icrg_max_neg_reg_wt "Avg IO Corruption (Max)";
label var lji "Judicial Independence";
label var wgi_law "Rule of Law";
label var IGO_icrg_avg_reg_mandate_wt_neg "Avg IO Corruption (Mandates)";
label var IGO_icrg_avg_reg_nomand_wt_neg "Avg IO Corruption (No Mandates)";
label var IGO_icrg_avg_neg_reg_growth "Avg IO Corruption Growth";
label var wt_icrg_region_neg "Regional Diffusion";
label var icrg_region_neg "Regional Diffusion";
label var wt_icrg_cont_avg_neg "Regional Diffusion";
label var icrg_cont_avg_neg "Regional Diffusion";
label var RIO_mandates_enforce "";
label var embeddedness_diff "";
label var conflict_inter "Interstate Conflict (Dummy)";
label var conflict_intra "Intrastate Conflict (Dummy)";
label var cpiscore_neg "Corruption (CPI)";
label var wgiscore_neg "Corruption (WGI)";
label var icrg_corruption_neg "Corruption";
label var RIO_memberships "Number of RIO Memberships";
label var fdi_gdp "FDI Inflows (% GDP)";
label var IGO_cpiscore_avg_reg_wt_neg "Avg IO Corruption (CPI)";
label var IGO_wgiscore_avg_neg_wt_reg "Avg IO Corruption (WGI)";
label var IGO_bribery_avg_reg_wt "Avg IO Corruption";
label var bribery_log "Corruption (Bribery)";
label var numvote "Government Vote (%)";
label var region "Region";
label var period "Time Trend";
label var RIO_mandates_enforce "Mandates (#)";
label var IGO_icrg_avg_wt_neg_reg "Avg IO Member Corruption";
label var RIO_mandates_enforce "Mandates (#)";
label var wgi_law "Rule of Law";
label var embeddedness_diff "Difference IO and Country";
label var lji "Judicial Independence";
label var numvote "Government Vote (%)";
label var mdmh "Mean District Magnitude (log)";
label var protestant "Protestant (%)";
label var presidential "Presidential System";
label var freedom_mean "Democracy";

tsset ccode period;



***************
**Table 1**;
***************


#delimit ;
local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable period;


xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg wt_icrg_region_neg `controlvars', robust fe; 
estimates store m1;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg wt_icrg_region_neg `controlvars', robust re;
estimates store m2;

xtreg icrg_corruption_neg L1.IGO_icrg_avg_wt_neg_reg L1.wt_icrg_region_neg `controlvars' , robust fe;
estimates store m3;

xtreg icrg_corruption_neg IGO_icrg_avg_neg_reg  icrg_region_neg `controlvars', robust fe;
estimates store m4;


esttab m1 m2 m3 m4 using replication_table1.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses") 
starlevels(* 0.10 ** 0.05 *** 0.01) mlabel("Main" "RE" "Lagged IV" "Unweighted") 
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations")) 
 varwidth(30)  collabels(none);

***************
**Table 3**;
***************



local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable wt_icrg_region_neg period;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg `controlvars'  if IGO_icrg_avg_neg_reg_growth>0 , robust fe;
estimates store m1;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg `controlvars' if IGO_icrg_avg_neg_reg_growth<0 , robust fe;
estimates store m2;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg `controlvars'  if embeddedness_diff>0& IGO_icrg_avg_neg_reg_growth<0 , robust fe;
estimates store m3;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg `controlvars'  if embeddedness_diff<0& IGO_icrg_avg_neg_reg_growth>0 , robust fe;
estimates store m4 ;


esttab m1 m2 m3 m4  using replication_table3.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses") 
 starlevels(* 0.10 ** 0.05 *** 0.01) mlabel("Decrease" "Increase" "Rel. Distance (Increase)" "Rel. Distance (Decrease)")
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations"))
 varwidth(30)  collabels(none);


***************
**Table 4**;
***************


local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable wt_icrg_region_neg period;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg RIO_mandates_enforce `controlvars', robust fe;
estimates store m1;

xtreg icrg_corruption_neg IGO_icrg_avg_reg_mandate_wt_neg `controlvars' , robust fe;
estimates store m2;

xtreg icrg_corruption_neg IGO_icrg_avg_reg_nomand_wt_neg `controlvars', robust fe;
estimates store m3;

esttab m1 m2 m3 using replication_table4.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses") 
 starlevels(* 0.10 ** 0.05 *** 0.01) mlabel("Mandates (#)" "Mandate" "No Mandate") 
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations")) 
 varwidth(30)  collabels(none);


***************
**Figure 3**;
***************

#delimit ;
gen interact=IGO_icrg_avg_wt_neg_reg*RIO_mandates_enforce;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg RIO_mandates_enforce interact polity2 gdppercap_log 
rgdppc_growth tradeopen durable wt_icrg_region_neg period, robust fe;

grinter RIO_mandates_enforce, inter(interact) const02(IGO_icrg_avg_wt_neg_reg) nomean kdensity clevel(90) 
yline(0,lpattern(dot) lcolor(black)) lcolor(black) lwidth(medthick) legend(off) scheme(s1mono) saving(mandate1,replace);

graph export replication_figure3.eps, replace;


drop interact;


***************
**Figure 4**;
***************

#delimit ;
gen interact=IGO_icrg_avg_wt_neg_reg*wgi_law;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg wgi_law interact polity2 gdppercap_log rgdppc_growth tradeopen 
durable  icrg_cont_avg_neg period , robust fe;

grinter IGO_icrg_avg_wt_neg_reg, inter(interact) const02(wgi_law) nomean kdensity clevel(90) yline(0,lpattern(dot) 
lcolor(black)) lcolor(black) lwidth(medthick) legend(off) scheme(s1mono);

graph export replication_figure4.eps, replace;
drop interact;



***************
**Appendix B**;
***************

#delimit ;
quietly gen x = uniform();
quietly regress x icrg_corruption_neg IGO_icrg_avg_wt_neg_reg polity2 gdppercap_log rgdppc_growth 
tradeopen durable icrg_cont_avg_neg;
estadd summ, mean sd min max;
esttab using replication_appendixB.rtf, replace  cells("mean sd min max") stats(N) drop(_cons) mlabels(,none) 
label varwidth(30);
drop x;


***************
**Appendix C**;
***************

#delimit ;
gen interact=embeddedness_diff*IGO_icrg_avg_wt_neg_reg;

local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable wt_icrg_region_neg period;
xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg embeddedness_diff interact `controlvars', robust fe;
grinter IGO_icrg_avg_wt_neg_reg, inter(interact) nomean const02(embeddedness_diff) kdensity clevel(90) 
lcolor(black) lwidth(medthick) legend(off) scheme(s1mono) saving(mandate2,replace);
graph export replication_appendixC.pdf, replace;

drop interact;

***************
**Appendix D**;
***************

/*Note: The boxplots in Appendix D are based on an IO-year level data set. The data set and do-file to generate this descriptive
figure are available upon request from the authors*/

***************
**Appendix E**;
***************



#delimit ;
gen interact=IGO_icrg_avg_wt_neg_reg*wgi_law;
xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg wgi_law interact polity2 gdppercap_log rgdppc_growth tradeopen 
durable  icrg_cont_avg_neg period , robust fe;
estimates store m1;
drop interact;

gen interact=lji*IGO_icrg_avg_wt_neg_reg;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg lji interact polity2 gdppercap_log rgdppc_growth tradeopen durable  
icrg_cont_avg_neg period, robust fe ;
estimates store m2;

grinter IGO_icrg_avg_wt_neg_reg, inter(interact) const02(lji) nomean kdensity clevel(90) yline(0) lcolor(black) 
lwidth(medthick) legend(off) scheme(s1mono);

graph export replication_appendixE-figure.pdf, replace;

drop interact;

esttab m1 m2 using replication_appendixE-table.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses") 
 starlevels(* 0.10 ** 0.05) mlabel("Rule of Law" "Judicial Independence") 
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations")) 
 varwidth(30)  collabels(none);

***************
**Appendix F**;
***************

#delimit ;


local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable  period;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg icrg_region_neg `controlvars', robust fe;
estimates store m1;


xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg wt_icrg_cont_avg_neg `controlvars', robust fe;
estimates store m2;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg icrg_cont_avg_neg `controlvars', robust fe;
estimates store m3;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg `controlvars', robust fe;
estimates store m4;


esttab m1 m2 m3 m4 using replication_appendixF.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses") 
 starlevels(* 0.10 ** 0.05 *** 0.01) mlabel("Region (UW)"  "Neighbor" "Neighbor (UW)" "No Region") 
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations")) 
 varwidth(30)  collabels(none);

***************
**Appendix G**;
***************

#delimit ;

local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable wt_icrg_region_neg period;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg  `controlvars'  fdi_gdp RIO_memberships conflict_inter 
conflict_intra numvote  mdmh protestant presidential, robust fe;
estimates store m1;

xtreg icrg_corruption_neg IGO_icrg_max_neg_reg_wt  `controlvars' , robust fe;
estimates store m2;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg  freedom_mean gdppercap_log rgdppc_growth tradeopen 
durable wt_icrg_region_neg period, robust fe;
estimates store m3;


esttab  m1 m2 m3 using replication_appendixG.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses") 
starlevels(* 0.10 ** 0.05 *** 0.01) mlabel("Controls" "Max" "Democracy") 
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations")) 
 varwidth(30)  collabels(none);

***************
**Appendix H**;
***************


local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable  wt_icrg_region_neg period;


xtreg wgiscore_neg IGO_wgiscore_avg_neg_wt_reg  `controlvars' ,  robust fe;
estimates store m1;

xtreg cpiscore_neg IGO_cpiscore_avg_reg_wt_neg  `controlvars'   if period<10, robust fe;
estimates store m2;

reg bribery_log IGO_bribery_avg_reg_wt  polity2 gdppercap_log rgdppc_growth tradeopen durable wt_icrg_region_neg , robust ;
estimates store m3;


esttab  m1 m2 m3 using replication_appendixH.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses") 
starlevels(* 0.10 ** 0.05 *** 0.01) mlabel("WGI" "CPI" "Bribery") 
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations")) 
 varwidth(30)  collabels(none);


***************
**Appendix I**;
***************

#delimit ;
local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable wt_icrg_region_neg period;


xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg `controlvars', robust fe;
estimates store m1;

xtreg icrg_corruption_neg IGO_icrg_avg_neg_econreg_wt `controlvars', robust fe;
estimates store m2;

xtreg icrg_corruption_neg IGO_icrg_avg_neg_polreg_wt `controlvars', robust fe;
estimates store m3;

xtreg icrg_corruption_neg IGO_icrg_avg_neg_socialreg_wt `controlvars', robust fe;
estimates store m4;



esttab m1 m2 m3 m4  using replication_appendixI.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses") 
 starlevels(* 0.10 ** 0.05 *** 0.01) mlabel("All IOs" "Economic" "Political" "Social") 
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations")) 
 varwidth(30)  collabels(none);


 
***************
**Appendix J**;
***************


#delimit ;
local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable  wt_icrg_region_neg period;


xtreg icrg_corruption_neg L1.icrg_corruption_neg IGO_icrg_avg_wt_neg_reg `controlvars', robust fe;
estimates store m1;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg `controlvars', be;
estimates store m2;

xtreg  icrg_corruption_neg IGO_icrg_avg_wt_neg_reg `controlvars' i.period i.region, robust; 
estimates store m3;

xtreg  icrg_corruption_neg IGO_icrg_avg_wt_neg_reg `controlvars' i.regper, robust ;
estimates store m4;


xtabond2 icrg_corruption_neg  IGO_icrg_avg_wt_neg_reg wt_icrg_region_neg polity2 gdppercap_log rgdppc_growth 
tradeopen durable  i.region period, gmm(IGO_icrg_avg_wt_neg_reg, laglimits(4 .)) iv( polity2 gdppercap_log rgdppc_growth 
tradeopen durable i.region period) twostep  small robust artests(4);
estimates store m5;

esttab m1 m2 m3 m4 m5 using replication_appendixJ.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses") 
starlevels(* 0.10 ** 0.05 *** 0.01) mlabel("LDV" "BE" "Period & Region" "Period-Region" "GMM" ) 
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations")) 
 varwidth(30)  collabels(none);


 
 
***************
**Appendix K**;
***************

 #delimit ;
use replication_ISQ.dta, replace; 

tsset ccode year;

local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable  wt_icrg_region_neg year;

xtreg icrg_corruption_neg L1.IGO_icrg_avg_wt_neg_reg  `controlvars', robust fe;

estimates store m1;

xtreg icrg_corruption_neg L2.IGO_icrg_avg_wt_neg_reg  `controlvars', robust fe;
estimates store m2;


gen period=.;
replace period = 6 if year==2013|year==2012;
replace period = 5 if year==2011|year==2010|year==2009|year==2008|year==2007;
replace period = 4 if year==2006|year==2005|year==2004|year==2003|year==2002;
replace period = 3 if year==2001|year==2000|year==1999|year==1998 | year==1997;
replace period = 2 if year==1996|year==1996 | year==1995|year==1994|year==1993;
replace period = 1 if year==1992|year==1991|year==1990|year==1989|year==1988;

drop if period==.;

collapse polity2 gdppercap_log rgdppc_growth tradeopen durable  icrg_corruption_neg 
IGO_icrg_avg_wt_neg_reg wt_icrg_region_neg IGO_icrg_avg_neg_reg  icrg_region_neg 
wt_icrg_cont_avg_neg icrg_cont_avg_neg IGO_icrg_avg_neg_reg_growth embeddedness_diff RIO_mandates_enforce 
IGO_icrg_avg_reg_mandate_wt_neg IGO_icrg_avg_reg_nomand_wt_neg wgiscore_neg IGO_wgiscore_avg_neg_wt_reg 
cpiscore_neg IGO_cpiscore_avg_reg_wt_neg  bribery_log IGO_bribery_avg_reg_wt  fdi_gdp RIO_memberships 
numvote IGO_icrg_avg_wt_neg IGO_icrg_avg_neg_econreg_wt  mdmh protestant IGO_icrg_max_neg_reg_wt freedom_mean
IGO_icrg_avg_neg_polreg_wt IGO_icrg_avg_neg_socialreg_wt region lji wgi_law  
 (max) conflict_inter conflict_intra presidential, by(period ccode);
 
label var polity2 "Democracy";
label var rgdppc_growth "PC GDP Growth (%)";
label var gdppercap_log "PC GDP (log)";
label var tradeopen "Trade Openness";
label var durable "Regime Durability";
label var IGO_icrg_avg_neg_reg "Avg IO Corruption";
label var IGO_icrg_avg_wt_neg_reg "Avg IO Corruption";
label var IGO_icrg_avg_wt_neg_reg "Avg IO Corruption";
label var IGO_icrg_avg_wt_neg "Avg IO Corruption (All)";
label var IGO_icrg_avg_neg_econreg_wt "Avg IO Corruption (Econ)";
label var IGO_icrg_avg_neg_polreg_wt "Avg IO Corruption (Pol)";
label var IGO_icrg_avg_neg_socialreg_wt "Avg IO Corruption (Social)";
label var IGO_icrg_max_neg_reg_wt "Avg IO Corruption (Max)";
label var lji "Judicial Independence";
label var wgi_law "Rule of Law";
label var IGO_icrg_avg_reg_mandate_wt_neg "Avg IO Corruption (Mandates)";
label var IGO_icrg_avg_reg_nomand_wt_neg "Avg IO Corruption (No Mandates)";
label var IGO_icrg_avg_neg_reg_growth "Avg IO Corruption Growth";
label var wt_icrg_region_neg "Regional Diffusion";
label var icrg_region_neg "Regional Diffusion";
label var wt_icrg_cont_avg_neg "Regional Diffusion";
label var icrg_cont_avg_neg "Regional Diffusion";
label var RIO_mandates_enforce "";
label var embeddedness_diff "";
label var conflict_inter "Interstate Conflict (Dummy)";
label var conflict_intra "Intrastate Conflict (Dummy)";
label var cpiscore_neg "Corruption (CPI)";
label var wgiscore_neg "Corruption (WGI)";
label var icrg_corruption_neg "Corruption";
label var RIO_memberships "Number of RIO Memberships";
label var fdi_gdp "FDI Inflows (% GDP)";
label var IGO_cpiscore_avg_reg_wt_neg "Avg IO Corruption (CPI)";
label var IGO_wgiscore_avg_neg_wt_reg "Avg IO Corruption (WGI)";
label var IGO_bribery_avg_reg_wt "Avg IO Corruption";
label var bribery_log "Corruption (Bribery)";
label var numvote "Government Vote (%)";
label var region "Region";
label var period "Time Trend";
label var RIO_mandates_enforce "Mandates (#)";
label var IGO_icrg_avg_wt_neg_reg "Avg IO Member Corruption";
label var RIO_mandates_enforce "Mandates (#)";
label var wgi_law "Rule of Law";
label var embeddedness_diff "Difference IO and Country";
label var lji "Judicial Independence";
label var numvote "Government Vote (%)";
label var mdmh "Mean District Magnitude (log)";
label var protestant "Protestant (%)";
label var presidential "Presidential System";
label var freedom_mean "Democracy";

tsset ccode period;

local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable  wt_icrg_region_neg period;

xtreg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg  `controlvars' , robust fe;
estimates store m3;

use replication_ISQ.dta, replace; 

drop if year<1985 & year>2013;

collapse polity2 gdppercap_log rgdppc_growth tradeopen durable  icrg_corruption_neg 
IGO_icrg_avg_wt_neg_reg wt_icrg_region_neg IGO_icrg_avg_neg_reg  icrg_region_neg 
wt_icrg_cont_avg_neg icrg_cont_avg_neg IGO_icrg_avg_neg_reg_growth embeddedness_diff RIO_mandates_enforce 
IGO_icrg_avg_reg_mandate_wt_neg IGO_icrg_avg_reg_nomand_wt_neg wgiscore_neg IGO_wgiscore_avg_neg_wt_reg 
cpiscore_neg IGO_cpiscore_avg_reg_wt_neg  bribery_log IGO_bribery_avg_reg_wt  fdi_gdp RIO_memberships 
numvote IGO_icrg_avg_wt_neg IGO_icrg_avg_neg_econreg_wt  mdmh protestant IGO_icrg_max_neg_reg_wt freedom_mean
IGO_icrg_avg_neg_polreg_wt IGO_icrg_avg_neg_socialreg_wt region lji wgi_law  
 (max) conflict_inter conflict_intra presidential, by(ccode);

label var polity2 "Democracy";
label var rgdppc_growth "PC GDP Growth (%)";
label var gdppercap_log "PC GDP (log)";
label var tradeopen "Trade Openness";
label var durable "Regime Durability";
label var IGO_icrg_avg_neg_reg "Avg IO Corruption";
label var IGO_icrg_avg_wt_neg_reg "Avg IO Corruption";
label var IGO_icrg_avg_wt_neg_reg "Avg IO Corruption";
label var IGO_icrg_avg_wt_neg "Avg IO Corruption (All)";
label var IGO_icrg_avg_neg_econreg_wt "Avg IO Corruption (Econ)";
label var IGO_icrg_avg_neg_polreg_wt "Avg IO Corruption (Pol)";
label var IGO_icrg_avg_neg_socialreg_wt "Avg IO Corruption (Social)";
label var IGO_icrg_max_neg_reg_wt "Avg IO Corruption (Max)";
label var lji "Judicial Independence";
label var wgi_law "Rule of Law";
label var IGO_icrg_avg_reg_mandate_wt_neg "Avg IO Corruption (Mandates)";
label var IGO_icrg_avg_reg_nomand_wt_neg "Avg IO Corruption (No Mandates)";
label var IGO_icrg_avg_neg_reg_growth "Avg IO Corruption Growth";
label var wt_icrg_region_neg "Regional Diffusion";
label var icrg_region_neg "Regional Diffusion";
label var wt_icrg_cont_avg_neg "Regional Diffusion";
label var icrg_cont_avg_neg "Regional Diffusion";
label var RIO_mandates_enforce "";
label var embeddedness_diff "";
label var conflict_inter "Interstate Conflict (Dummy)";
label var conflict_intra "Intrastate Conflict (Dummy)";
label var cpiscore_neg "Corruption (CPI)";
label var wgiscore_neg "Corruption (WGI)";
label var icrg_corruption_neg "Corruption";
label var RIO_memberships "Number of RIO Memberships";
label var fdi_gdp "FDI Inflows (% GDP)";
label var IGO_cpiscore_avg_reg_wt_neg "Avg IO Corruption (CPI)";
label var IGO_wgiscore_avg_neg_wt_reg "Avg IO Corruption (WGI)";
label var IGO_bribery_avg_reg_wt "Avg IO Corruption";
label var bribery_log "Corruption (Bribery)";
label var numvote "Government Vote (%)";
label var region "Region";
label var RIO_mandates_enforce "Mandates (#)";
label var IGO_icrg_avg_wt_neg_reg "Avg IO Member Corruption";
label var RIO_mandates_enforce "Mandates (#)";
label var wgi_law "Rule of Law";
label var embeddedness_diff "Difference IO and Country";
label var lji "Judicial Independence";
label var numvote "Government Vote (%)";
label var mdmh "Mean District Magnitude (log)";
label var protestant "Protestant (%)";
label var presidential "Presidential System";
label var freedom_mean "Democracy";


local controlvars polity2 gdppercap_log rgdppc_growth tradeopen durable  wt_icrg_region_neg;


reg icrg_corruption_neg IGO_icrg_avg_wt_neg_reg  `controlvars', robust ;
estimates store m4;



esttab m1 m2 m3 m4 using replication_appendixK.rtf, replace label modelwidth(10) addnote("Standard errors in parentheses")  starlevels(* 0.10 ** 0.05) mlabel("Annual" "Annual" "5-year Periods" "Cross-Section" "Cross-Section") 
legend cells(b(star fmt(3)) se(par)) stats(F r2 N, star labels("F-Test" "R2" "Observations")) 
 varwidth(30)  collabels(none);



log close;
exit;
